<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript" src="/except/zhaiji/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="/except/zhaiji/js/jquery.form.js"></script>
    <script type="text/javascript">
        function edituserinfo() {
            var url = "/except/usercontroller/edituserinfo.controller";
            var options = {
                url: url,
                type: 'post',
                dataType: "json",
                success: function (data) {
                    var code = data.code;
                    var message = data.message;
                    if (code == 10001)
                        location.href = "/except/login.jsp";
                    else if (code == 20000)
                        alert("修改成功");
                    else
                        alert(message);
                },
                error: function (data) {
                    var responseText = data.responseText;
                    responseText = responseText.replace('<pre style="word-wrap: break-word; white-space: pre-wrap;">', '').replace('</pre>', '');
                    var json = eval("(" + responseText + ")");
                    var code = json.code;
                    var message = json.message;
                    if (code == 10001)
                        location.href = "/except/login.jsp";
                    else if (code == 20000)
                        alert("修改成功");
                    else
                        alert(message);
                }
            };
            $("#userfrm").ajaxSubmit(options);
        }
    </script>
</head>

<body>
    <form id="userfrm" action="/except/usercontroller/edituserinfo.do" method="post" enctype="multipart/form-data">
        token:<input name="json" value="{token:6565366164336578636570743062653631373434356261636534386339393133393234363866}"/><br/>
        头像地址：<input type="file" name="headimg"/><br/>
        昵称：<input name="nickname" /><br/>
        性别：<input name="sex"/><br/>
        <input type="button" onclick="edituserinfo();"/>
    </form>
</body>
</html>